<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="js/jquery.js"></script>
    <script src="js/common.js"></script>
    <script>
        window.onload=function (){
            $.ajax({
                url:url+"emp/allemp",
                success:function (data){
                    let str=` <tr>
                        <td>员工编号</td>
                        <td>姓名</td>
                        <td>图片</td>
                        <td>部门名称</td>
                        <td>部门位置</td>
                    </tr>`;
                    //第一个参数为对象数组  第二个参数为回调函数
                    $.each(data,function (i,obj){
                        str+=`<tr>
                        <td>${obj.empno}</td>
                        <td>${obj.ename}</td>
                        <td><img src="${url}upload/${obj.epic}"/></td>
                        <td>${obj.d.dname}</td>
                        <td>${obj.d.loc}</td>
                    </tr>`;
                    });
                    //替换
                    $("table").html(str);
                }
            })
        }
    </script>
</head>
<body>
<table>

</table>
</body>
</html>